// https://www.lintcode.com/problem/single-number/my-submissions?_from=ladder&&fromId=6

class Solution {
public:
    /**
     * @param A: An integer array
     * @return: An integer
     */
    int singleNumber(vector<int> &A) {
        if (A.empty()) return NULL;
        int result = A[0];
        for (int i = 1; i < A.size(); ++i)
        {
            result ^= A[i];
        }
        return result;
    }
};